import java.util.*;

public class B_3 {
    static Queue<Module> queue = new LinkedList<>();
    public static void main(String[] args) {
        Scanner sc = new Scanner(System.in);
        int n = sc.nextInt();
        int m = sc.nextInt();
        char[][] a = new char[m][n];
        List<Character> list = new ArrayList<>();
        for (int i = 0; i < m; i++) {
            String str = sc.next();
            a[i] = str.toCharArray();
        }
        Module start = new Module(0,0,0);
        queue.add(start);
        StringBuilder sb = new StringBuilder();
        a[0][0] = 3;
        while (!queue.isEmpty()){
            int x = queue.peek().x;
            int y = queue.peek().y;
            if (x == n-1&&y == m-1){
                System.out.println(queue.peek().num);
                System.out.println(sb.toString());
            }
            if (x<a[0].length-1&&a[y][x+1]=='0'){
                queue.add(new Module(x+1,y,queue.peek().num+1));
                a[y][x+1] = '3';
                sb.append("R");
            }
            if (x>0&&a[y][x-1]=='0'){
                queue.add(new Module(x-1,y,queue.peek().num+1));
                a[y][x-1] = '3';
                sb.append("L");
            }
            if (y<a.length-1&&a[y+1][x]=='0'){
                queue.add(new Module(x,y+1,queue.peek().num+1));
                a[y+1][x] = '3';
                sb.append("D");
            }
            if (y>0&&a[y-1][x]=='0'){
                queue.add(new Module(x,y-1,queue.peek().num+1));
                a[y-1][x] = '3';
                sb.append("U");
            }
            queue.remove();
        }
    }
}
class Module{
        int x,y,num;

    public Module(int x, int y, int num) {
        this.x = x;
        this.y = y;
        this.num = num;
    }
}